package com.darrenchan.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @Desc
 * @Author chenchi03
 * @CreateTime 2020-10-12 20:14
 */
public class Test4 {
    public static void main(String[] args) {

    }

    public List<String> getRes(int[] nums) {
        List<String> res = new ArrayList<>();
        if(nums == null || nums.length == 0) {
            return res;
        }

        dfs(nums, 0, new ArrayList<>(), res);
        return res;
    }

    public void dfs(int[] nums, int index, List<String> subsets, List<String> res) {
        if(subsets.size() == 3) {
            res.add(String.join("", subsets));
        }

        for(int i = index; i < nums.length; i++) {
            subsets.add(nums[i] + "");
            dfs(nums, i + 1, subsets, res);
            subsets.remove(subsets.size() - 1);
        }
    }
}
